#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
	int arr[1000] = { 0 };
	int T = 0; 
	int count = 0;
	scanf("%d", &T);
	for(int i = 0;i<T;i++)
	{
		scanf("%d", &arr[i]);
	}
	for (int m = 0; m < T;m++)
	{
		for (int n = m + 1; n < T; n++)
		{
			if (arr[m]*m == arr[n]*n)
			{
				count++;
			}
		}
	}
	printf("%d", count);
	return 0;
}


#include <stdio.h>

int countMatchingPairs(int arr[], int N) {
	int count = 0;
	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			if (arr[i] * j == arr[j] * i) {
				count++;
			}
		}
	}
	return count;
}

int main() {
	int N;
	scanf("%d", &N);
	int A[];
	for (int i = 0; i < N; i++) {
		scanf("%d", &A[i]);
	}
	int result = countMatchingPairs(A, N);
	printf("%d\n", result);
	return 0;
}
